﻿using IOP.Net;
using System;
using System.Threading.Tasks;

namespace IOP.Pulsar.Abstractions
{
    /// <summary>
    /// 管线客户端
    /// </summary>
    public interface IProductLineClient<TContext> : IDisposable
        where TContext : class
    {
        /// <summary>
        /// 连接的嵌套字
        /// </summary>
        SocketMonitor ConnectedSocket { get; }
        /// <summary>
        /// 是否连接
        /// </summary>
        bool IsConnected { get; }
        /// <summary>
        /// 是否释放连接
        /// </summary>
        bool IsDispose { get; }
        /// <summary>
        /// 生产线入口
        /// </summary>
        IProductLineEntry<TContext> ProductLineEntry { get; }
        /// <summary>
        /// 客户端配置
        /// </summary>
        IClientOptions ClientOption { get; }
        /// <summary>
        /// 执行连接
        /// </summary>
        /// <param name="option"></param>
        Task ConnectAsync(IClientOptions option);
        /// <summary>
        /// 发送消息
        /// </summary>
        /// <param name="data"></param>
        void Send(Span<byte> data);
        /// <summary>
        /// 断开连接
        /// </summary>
        void Disconnect();
    }
}
